#include <stdio.h>
#include <stdlib.h>

#define kMaxSize 100000
typedef int ElemSet;

typedef int Position; /* 整型下标，表示元素的位置 */
typedef struct ListNode *List;
struct ListNode {
    ElemSet data[kMaxSize]; /* 存储数据的数组 */
    Position last; /* 线性表中最后一个元素在数组中的位置 */
};

List ReadInput();
Position LongestCIS(List list);
void PrintResult(List list, Position left);

int main(void) {
    List list;
    Position left;

    list = ReadInput(); /* 读入整个序列 */
    left = LongestCIS(list); /* 获得最长连续递增子序列最左端点 */
    PrintResult(list, left); /* 输出从left开始的连续递增子序列 */

    return 0;
}

List ReadInput() {
    List list;
    int n;

    list = (List)malloc(sizeof(struct ListNode));
    scanf("%d", &n);
    for (list->last = 0; list->last < n; list->last++)
        scanf("%d", &list->data[list->last]);
    list->last--;
    return list;
}

Position LongestCIS(List list) {
    Position left, this_left, i;
    int max_len, this_len;

    /* 初始化当前子序列为data[0] */
    left = this_left = 0;
    max_len = this_len = 1;
    for (i = 1; i <= list->last; i++) {
        if (list->data[i - 1] < list->data[i]) { /*递增*/
            this_len++;
        } else { /* data[i]不属于当前递增子序列 */
            if (this_len > max_len) { /*若是更长序列 */
                max_len = this_len;
                left = this_left;
            }
            /* 将data[i]计入下一个子序列 */
            this_left = i;
            this_len = 1;
        }
    }
    if (this_len > max_len) { /* 处理末尾的子序列 */
        max_len = this_len;
        left = this_left;
    }
    return left;
}

void PrintResult(List list, Position left) {
    Position i;

    printf("%d", list->data[left]);
    for (i = left + 1; i <= list->last && list->data[i - 1] < list->data[i]; i++)
        printf(" %d", list->data[i]);
    printf("\n");
}